import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Admin
 * Date: 2022-12-07
 * Time: 17:09
 */
public class Demo2 {
    public static int func(int[] array,int n) {
        int dp[] = new int[n];

        dp[0] = 1;
        int sum = 1;

        for(int i = 1; i < n; i++) {
            dp[i] = 1;
            for(int j = 0; j < i; j++) {
                if(array[i] > array[j]) {
                    dp[i] = Math.max(dp[i],dp[j]+1);
                }
            }
            sum = Math.max(dp[i],sum);
        }

        return sum;
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        while(scan.hasNextInt()) {

            int n = scan.nextInt();
            int[] array = new int[n];
            for(int i = 0; i < array.length; i++) {
                array[i] = scan.nextInt();
            }

            System.out.println(func(array,n));
        }
    }
}
